package com.feng.study.demo.juc;

import com.feng.study.value.User;
import com.google.common.collect.Lists;

import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;

public class JUCDemo04 {
    public static void main(String[] args) {
//        StampedLock stampedLock = new StampedLock();
//        long l = stampedLock.writeLock();
//        stampedLock.tryOptimisticRead();
//        stampedLock.unlockWrite(l);
//
//        AtomicInteger atomicInteger = new AtomicInteger(11);
//        int i = atomicInteger.addAndGet(11);
//        System.out.println(i);

        int a = 7;
        long ll = 128L >> a;
        System.out.println(ll);

        List<User> list = Lists.newArrayList();
        list.add(new User());
        list.add(null);
        for (User user : list) {
            user.setName("dhh");
            return;
        }
        System.out.println();
        List<User> customerImportVos = list.stream().filter(f -> f.getName() != null).collect(Collectors.toList());
        System.out.println(customerImportVos);

        list.forEach(f -> {
            if (f.getName() != null) {
                System.out.println(f.getName());
                return;
            }
        });
    }

    public static void demoAQS() {
        ReentrantLock reentrantLock = new ReentrantLock();
    }
}
